package com.dxq.oa.ontroller;

import com.dxq.oa.entity.Role;
import com.dxq.oa.entity.User;
import com.dxq.oa.pub.OaResult;
import com.dxq.oa.pub.ResponseData;
import com.dxq.oa.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/role")
@Slf4j
public class RoleController {
    @Autowired
    private RoleService roleService;
    @GetMapping("/getrole")
    public ResponseData getRole(Integer pagenum,Integer pageSize){
        log.info("获取角色列表请求---------------");
        pagenum = pagenum == null ? 1:pagenum;
        pageSize = pageSize ==null?10:pageSize;
        List<Role> byPage = this.roleService.findRole(pagenum, pageSize);
        long totol = this.roleService.totol();
        log.info("总共"+totol+"条数据");
        return new ResponseData("SUCCESS",byPage,String.valueOf(totol));
    }
}
